Skip to content

fix(apps): write Deno runtime config to temp directory#41338

Merged
dionisio-bot[bot] merged 7 commits into
RocketChat:developfrom
AlgoArtist06:fix/41006-deno-runtime-config-permissions
Jul 16, 2026
Merged

fix(apps): write Deno runtime config to temp directory#41338
dionisio-bot[bot] merged 7 commits into
RocketChat:developfrom
AlgoArtist06:fix/41006-deno-runtime-config-permissions

Conversation

@AlgoArtist06

@AlgoArtist06 AlgoArtist06 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • write the generated Deno runtime config to a controller-specific directory under the host-provided temp path
  • resolve relative import-map targets against the installed static config before moving it
  • remove each controller’s runtime directory on construction failure or shutdown
  • add regression coverage for the writable location, import resolution, isolation, and cleanup

Closes #41006

Testing

  • ../../node_modules/.bin/tsc -p tsconfig.json --noEmit
  • ../../node_modules/.bin/eslint src/server/runtime/deno/AppsEngineDenoRuntime.ts tests/server/runtime/DenoRuntimeSubprocessController.test.ts
  • focused controller lifecycle smoke check for isolated config creation and cleanup

The full Deno runtime integration test could not complete locally because the environment has Deno 2.9.2 while the repository pins Deno 2.3.1; its shared startup hook timed out before the regression assertions ran.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Fixed app startup failures in Docker deployments configured with specific user IDs by addressing permission-related EACCES issues.
    • Improved runtime module resolution during app startup to ensure dependencies are mapped correctly across supported deployment environments.
    • Updated the temporary runtime configuration handling to produce more consistent configuration output during ephemeral runtime launches.

@AlgoArtist06
AlgoArtist06 requested a review from a team as a code owner July 13, 2026 12:41
@changeset-bot

changeset-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 88dd944

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@rocket.chat/apps Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dionisio-bot

dionisio-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 36df0df3-0765-4b15-a3a3-532cc828b141

📥 Commits

Reviewing files that changed from the base of the PR and between 87a4fb4 and 88dd944.

📒 Files selected for processing (1)
  • .changeset/tidy-snails-smile.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/tidy-snails-smile.md
📜 Recent review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: cubic · AI code reviewer
⚠️ CI failures not shown inline (1)

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**

Walkthrough

The Deno runtime now resolves package imports from packagePath and writes its ephemeral configuration under the temporary directory. A Changesets entry records a patch release for @rocket.chat/apps and documents the Docker startup error fix.

Changes

Deno runtime writable configuration

Layer / File(s) Summary
Resolve ephemeral runtime imports
packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts
generateEphemeralDenoConfig accepts packagePath, adds package and base-runtime import mappings, and receives the path from the controller.
Isolate runtime configuration artifacts
packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts, .changeset/tidy-snails-smile.md
The ephemeral configuration is written as deno.runtime.jsonc inside the temporary directory, with a patch release changeset documenting the startup error fix.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: type: bug

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: moving the Deno runtime config write location to the temp directory.
Linked Issues check ✅ Passed The runtime now writes ephemeral config under the host temp path, addressing the non-root EACCES startup failure in #41006.
Out of Scope Changes check ✅ Passed The changes stay focused on the Deno runtime fix and a release notes entry, with no obvious unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/apps/tests/server/runtime/DenoRuntimeSubprocessController.test.ts Outdated
@AlgoArtist06

Copy link
Copy Markdown
Contributor Author

The implementation and regression coverage have been locally verified (yarn jest packages/apps/tests/server/runtime/DenoRuntimeSubprocessController.test.ts --runInBand and yarn prettier --check on all changed files), and the available automated checks are passing. I cannot apply stat: QA assured: that label is reserved for company-insider approval, and the GitHub API returns HTTP 403 for my account. I also cannot assign an upstream milestone/project. Maintainers: please perform/confirm QA and assign the appropriate milestone or project when triaging this community PR.

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.45%. Comparing base (bfacbd3) to head (88dd944).
⚠️ Report is 4 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #41338      +/-   ##
===========================================
- Coverage    68.45%   68.45%   -0.01%     
===========================================
  Files         4092     4092              
  Lines       158217   158213       -4     
  Branches     28595    28651      +56     
===========================================
- Hits        108315   108306       -9     
- Misses       44866    44884      +18     
+ Partials      5036     5023      -13     
Flag Coverage Δ
e2e 59.22% <ø> (-0.05%) ⬇️
e2e-api 45.49% <ø> (+<0.01%) ⬆️
unit 70.33% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts (1)

79-85: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Avoid EPERM on Windows by using junction for directory symlinks.

When running the development environment on Windows, fs.symlinkSync with the 'dir' type requires Administrator privileges or Developer Mode. Without them, it will throw an EPERM error and crash the runtime startup.

Changing the type to 'junction' avoids this requirement on Windows and is safely ignored on POSIX platforms (Linux/macOS).

♻️ Proposed fix
 		try {
-			fs.symlinkSync(path.dirname(this.denoConfigPath), path.dirname(this.denoRuntimePath), 'dir');
+			fs.symlinkSync(path.dirname(this.denoConfigPath), path.dirname(this.denoRuntimePath), 'junction');
 		} catch (reason: unknown) {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts` around lines
79 - 85, Update the fs.symlinkSync call in the AppsEngineDenoRuntime startup
setup to use the 'junction' directory-link type instead of 'dir', preserving the
existing EEXIST handling and rethrow behavior for other errors.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts`:
- Around line 40-43: Update the import-map target construction in
AppsEngineDenoRuntime to use POSIX/URL-style separators for the
`@rocket.chat/apps-engine/`, `@rocket.chat/apps/base-runtime/`, and
`@rocket.chat/apps/` entries; replace platform-dependent path.join usage with
path.posix.join or pathToFileURL while preserving the existing target locations.
- Around line 71-74: Update the AppsEngineDenoRuntime constructor to create a
unique controller-specific temporary subdirectory beneath
manager.getTempFilePath(), and place deno.runtime.jsonc and the deno-runtime
symlink under that directory. Track the directory for cleanup, removing it in
stopApp() and when constructor initialization fails. Ensure concurrent Deno
controllers never share these paths.

---

Nitpick comments:
In `@packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts`:
- Around line 79-85: Update the fs.symlinkSync call in the AppsEngineDenoRuntime
startup setup to use the 'junction' directory-link type instead of 'dir',
preserving the existing EEXIST handling and rethrow behavior for other errors.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1cfd7cc3-fc0c-4d2f-8a50-13a90af0f7da

📥 Commits

Reviewing files that changed from the base of the PR and between cfb2530 and aa29200.

📒 Files selected for processing (2)
  • .changeset/tidy-snails-smile.md
  • packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
⚠️ CI failures not shown inline (1)

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts
🧠 Learnings (5)
📚 Learning: 2026-03-16T21:50:37.589Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39676
File: .changeset/migrate-users-register-openapi.md:3-3
Timestamp: 2026-03-16T21:50:37.589Z
Learning: For changes related to OpenAPI migrations in Rocket.Chat/OpenAPI, when removing endpoint types and validators from rocket.chat/rest-typings (e.g., UserRegisterParamsPOST, /v1/users.register) document this as a minor changeset (not breaking) per RocketChat/Rocket.Chat-Open-API#150 Rule 7. Note that the endpoint type is re-exposed via a module augmentation .d.ts in the consuming package (e.g., packages/web-ui-registration/src/users-register.d.ts). In reviews, ensure the changeset clearly states: this is a non-breaking change, the major version should not be bumped, and the changeset reflects a minor version bump. Do not treat this as a breaking change during OpenAPI migrations.

Applied to files:

  • .changeset/tidy-snails-smile.md
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts
📚 Learning: 2026-05-11T21:46:23.471Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 40463
File: packages/apps/src/lib/SecureFields.ts:17-19
Timestamp: 2026-05-11T21:46:23.471Z
Learning: In Rocket.Chat’s `packages/apps/tsconfig.json`, TypeScript `"strict"` is set to `false`, which disables strict type-checking (including `noImplicitAny`) for `packages/apps`. When reviewing, do not flag TS7053 (and similar strict-mode indexing/type errors) in files under `packages/apps/src/` that are a consequence of this relaxed strictness—e.g., patterns like indexing an `unknown`/`object` via optional chaining such as `object?.[kSecureFields]`.

Applied to files:

  • packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts
🔇 Additional comments (1)
.changeset/tidy-snails-smile.md (1)

1-6: LGTM!

Comment thread packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts
Comment thread packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts
Comment thread packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts
Comment thread packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts
Comment thread .changeset/tidy-snails-smile.md Outdated
@d-gubert

Copy link
Copy Markdown
Member

Hi, thanks for your contribution! I've simplified things a bit only, but you were on the right path

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
@d-gubert d-gubert added the stat: QA assured Means it has been tested and approved by a company insider label Jul 16, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Jul 16, 2026
@dionisio-bot
dionisio-bot Bot added this pull request to the merge queue Jul 16, 2026
Merged via the queue into RocketChat:develop with commit 2ec4d29 Jul 16, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge type: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Apps fail to load with EACCES on deno.runtime.jsonc when running container as non-root (8.5.x regression)

2 participants